/*
 * Copyright 2011 Clean GWT
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.cleangwt.user.cellview.client;

import com.google.gwt.cell.client.TextCell;
import com.google.gwt.cell.client.TextInputCell;

/**
 * A {@link DataColumn} used to present a text value or edit to it.
 * 
 * @author Jess
 * @version 1.0
 * @since 1.0
 */
public class TextColumn extends DataColumn<String> {

  public TextColumn() {
    this("");
  }

  /**
   * Creates a text column with the given data store name.
   * 
   * @param name the data store name
   */
  public TextColumn(String name) {
    this(name, false);
  }

  /**
   * Creates a text column with the given data store name and sortable.
   * 
   * @param name the data store name
   * @param sortable the sortable
   */
  public TextColumn(String name, boolean sortable) {
    this(name, sortable, false);
  }

  /**
   * Creates a text column with the given data store name, sortable and editable.
   * 
   * @param name the data store name
   * @param sortable the sortable
   * @param editable the editable
   */
  public TextColumn(String name, boolean sortable, boolean editable) {
    super(name, editable ? new TextInputCell() : new TextCell(), sortable, editable);
  }

  // @Override
  // public String getValue(SimpleObject object) {
  // return object.getString(getDataStoreName());
  // }
}
